﻿using System;

namespace TheSnake
{
    public class Status : GameObject
    {
        //Properties
        public int Lifes { get; set; }
        public int Points { get; set; }

        //Constructor
        public Status(MatrixCoords topLeft, int lifes, int points)
            : base(topLeft)
        {
            this.Lifes = lifes;
            this.Points = points;

            char[] lifesArray = (" Lifes: " + lifes.ToString()).ToCharArray();
            char[] pointsArray = (" Points: " + points.ToString()).ToCharArray();

            this.body = new char[2, 14];
            AddToBody(0, lifesArray);
            AddToBody(1, pointsArray);
        }
          
        //Methods
        private void AddToBody(int index, char[] charArray)
        {
            for (int i = 0; i < charArray.Length; i++)
            {
                this.body[index, i] = charArray[i];
            }
        }

        public override void Update()
        {
            char[] lifesArray = ((" Lifes: " + this.Lifes.ToString()).PadRight(13,' ')).ToCharArray();
            char[] pointsArray = ((" Points: " + this.Points.ToString()).PadRight(13, ' ')).ToCharArray();

            AddToBody(0, lifesArray);
            AddToBody(1, pointsArray);
        }
    }
}
